package com.yumeno.education.dao;

import com.yumeno.education.entity.Questions;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface QuestionsDao {
    @Select(value = "SELECT * FROM questions ORDER BY rand() LIMIT 1")
    Questions getQuestions();

    @Insert(value = "INSERT INTO questions(questions.question_body,questions.choice_a,questions.choice_b,questions" +
            ".choice_c,questions.choice_d,questions.correct,questions.insert_time,questions.hint) VALUES" +
            "(#{questionBody}," +
            "#{choiceA}," +
            "#{choiceB}," +
            "#{choiceC},#{choiceD},#{correct},#{insertTime},#{hint})")
    int add(Questions questions);
}
